<template>
  <div class="header">
    <div class="header-left">
      <div class="iconfont back-icon">&#xe602;</div>
    </div>
    <div class="header-input">
      <span class="iconfont">&#xe641;</span>
      输入城市/景点/游玩主题
    </div>
    <router-link to="/city">
    <div class="header-right">
      {{this.city}}
      <div class="iconfont arrow-icon">&#xe622;</div>
    </div>
    </router-link>
  </div>
</template>

<script>
  import {mapState} from 'vuex' //vuex提供的接口，用来映射state、mutation等
  export default {
    name: "HomeHeader",
    computed:{
      ...mapState(['city'])//mapState中传入一个数组，state中的属性key引用赋予数组中的值，然后返回这个数组。用...来解析这个数组，这样多了一个计算属性 city
    }
  }
</script>

<style lang="stylus" scoped>
   @import "~styles/variable.styl"
  .header
    display flex
    height .86rem
    line-height .86rem
    background-color $bgColor
    color #ffffff
    .header-left
      width .64rem
      float left
      .back-icon
        text-align center
        font-size .4rem
    .header-input
      flex 1
      height .64rem
      line-height .64rem
      margin-top .12rem
      margin-left .2rem
      background-color #ffffff
      color #acaba9
    .header-right
      display flex
      min-width 1.24rem
      padding-left .1rem
      float right
      color #fff
      .arrow-icon
       font-size .2rem
       flex 1
       margin-left .1rem
</style>
